<template>
  <!-- 顶部导航区域：logo + 导航 + 用户 -->
  <div class="top-nav">
    <!-- 金山 logo -->
    <div class="logo">
      <img src="@/assets/king.svg" alt="金山logo" class="king-svg" />
    </div>
    <!-- 导航菜单 -->
    <div class="nav-menu">
      <!-- 产品下拉列表 -->
      <div class="dropdown">
        <span class="dropdown-trigger">产品 ▾</span>
        <ul class="dropdown-menu" v-show="showProductMenu">
          <li>WPS Office</li>
          <li>WPS 365</li>
          <li>稻壳会员</li>
          <li>PDF工具</li>
        </ul>
      </div>
      
      <span>会员</span>
      <span class="active">企业</span>
      
      <!-- 支持下拉列表 -->
      <div class="dropdown">
        <span class="dropdown-trigger">支持 ▾</span>
        <ul class="dropdown-menu" v-show="showSupportMenu">
          <li>帮助中心</li>
          <li>视频教程</li>
          <li>常见问题</li>
          <li>联系客服</li>
        </ul>
      </div>
      
      <!-- 更多下拉列表 -->
      <div class="dropdown">
        <span class="dropdown-trigger">更多 ▾</span>
        <ul class="dropdown-menu" v-show="showMoreMenu">
          <li>关于我们</li>
          <li>加入我们</li>
          <li>合作伙伴</li>
          <li>隐私政策</li>
        </ul>
      </div>
    </div>
    <!-- 用户信息 -->
    <div class="user-info">
      <span class="user-circle">志华</span>
    </div>
  </div>

  <!-- 内容区域：图片+文字+切换按钮 -->
  <div class="content-section">
    <div 
      class="banner" 
      v-if="activeTab === 'wpsOffice'"
    >
      <img 
        src="@/assets/wps_office.png" 
        alt="wps_office" 
        class="banner-img" 
      />
      <div class="banner-text">
        <h2>WPS Office</h2>
        <p>一站式办公服务平台</p>
        <p>新升级，无广告，AI 办公更高效</p>
        <!-- 切换按钮 -->
        <div class="switch-btns">
          <button 
            @click="activeTab = 'wpsOffice'" 
            :class="{ active: activeTab === 'wpsOffice' }"
          >
            WPS Office
          </button>
          <button 
            @click="activeTab = 'wps365'" 
            :class="{ active: activeTab === 'wps365' }"
          >
            WPS 365
          </button>
        </div>
      </div>
    </div>
    <div 
      class="banner" 
      v-else
    >
      <img 
        src="@/assets/wps_365.png" 
        alt="wps_365" 
        class="banner-img" 
      />
      <div class="banner-text">
        <h2>W365</h2>
        <p>面向组织和企业的 WPS 365</p>
        <p>一站式 AI 办公，生产力即刻起飞</p>
        <!-- 切换按钮 -->
        <div class="switch-btns">
          <button 
            @click="activeTab = 'wpsOffice'" 
            :class="{ active: activeTab === 'wpsOffice' }"
          >
            WPS Office
          </button>
          <button 
            @click="activeTab = 'wps365'" 
            :class="{ active: activeTab === 'wps365' }"
          >
            WPS 365
          </button>
        </div>
      </div>
    </div>
  </div>

  <!-- 底部导航区域 -->
  <div class="bottom-nav">
    <div class="nav-items">
      <span>稻壳</span>
      <span>WPS协作</span>
      <span>WPS AI</span>
      <span>PDF</span>
      <span>手机版</span>
      <span>联系我们</span>
    </div>
  </div>

  <!-- 最底部的备案等信息区域 -->
  <div class="footer-info">
    <div class="info-left">
      <p>
        <img src="@/assets/police_icon.png" alt="公安备案图标" class="police-icon" />
        粤公网安备44049102496073号 
        <a href="#" class="icp-link">粤ICP备13015957号</a>
      </p>
      <p>Copyright © 金山办公 2025</p>
      <p><a href="#" class="license-link">营业执照</a></p>
    </div>
    <div class="info-middle">
      <p>购买与支持 400-677-5005</p>
      <p>互联网违法和不良信息举报邮箱 wps@wps.cn</p>
        <div>
        网上有害信息举报专区 
        <span class="dropdown-arrow" @click="toggleReportZone">▾</span>
        <ul class="report-zone-menu" v-show="showReportZone">
            <li><a href="#">举报指南</a></li>
            <li><a href="#">在线举报</a></li>
        </ul>
        </div>
    </div>
    <div class="info-right">
      <p>关于金山办公</p>
      <p>投资者关系</p>
    </div>
    <div class="lang-select">
      <select>
        <option>简体中文（中国大陆）</option>
        <option>English</option>
        <!-- 可根据需要添加更多语言选项 -->
      </select>
    </div>
  </div>
</template>

<script setup>
import { ref } from 'vue'
// 控制当前激活的 tab
const activeTab = ref('wpsOffice') 

// 控制下拉菜单显示与隐藏
const showProductMenu = ref(false)
const showSupportMenu = ref(false)
const showMoreMenu = ref(false)

// 控制网上有害信息举报专区的显示与隐藏
const showReportZone = ref(false)
const toggleReportZone = () => {
  showReportZone.value = !showReportZone.value
}
</script>

<style scoped>
/* 顶部导航样式 */
.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background-color: #fff;
  border-bottom: 1px solid #eee;
}
.king-svg {
  height: 36px; 
}
.nav-menu {
  display: flex;
  gap: 30px;
}
.nav-menu span {
  cursor: pointer;
  padding-bottom: 5px;
}
.nav-menu .active {
  border-bottom: 2px solid #000; 
}

/* 下拉列表样式 */
.dropdown {
  position: relative;
  display: inline-block;
}
.dropdown-trigger {
  position: relative;
  z-index: 10;
}
.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 150px;
  padding: 10px 0;
  margin: 0;
  list-style: none;
  background-color: #fff;
  border: 1px solid #eee;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  z-index: 9;
  display: none;
}
.dropdown-menu li {
  padding: 8px 16px;
  cursor: pointer;
  transition: background-color 0.2s;
}
.dropdown-menu li:hover {
  background-color: #f5f5f5;
}
/* 鼠标悬停显示下拉菜单 */
.dropdown:hover .dropdown-menu {
  display: block;
}

.user-info {
  display: flex;
  align-items: center;
}
.user-circle {
  width: 30px;
  height: 30px;
  line-height: 30px;
  text-align: center;
  background-color: #42b983;
  color: #fff;
  border-radius: 50%;
  font-size: 14px;
}

/* 内容区域样式 */
.content-section {
  position: relative;
  text-align: center;
  padding: 30px;
}
.banner-img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}
.banner-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #fff; 
  text-shadow: 1px 1px 2px rgba(0,0,0,0.6); 
}
.switch-btns {
  margin-top: 20px;
}
.switch-btns button {
  margin: 0 10px;
  padding: 8px 16px;
  border: 1px solid #ccc;
  background-color: #f8f8f8;
  cursor: pointer;
}
.switch-btns button.active {
  background-color: #007bff;
  color: #fff;
  border-color: #007bff;
}

/* 底部导航样式 */
.bottom-nav {
  background-color: #ccc;
}
.nav-items {
  display: flex;
  justify-content: center;
  gap: 20px; 
  padding: 10px 0;
}
.nav-items span {
  color: #fff;
  cursor: pointer;
}

/* 最底部信息样式 */
.footer-info {
  display: flex;
  justify-content: space-between;
  padding: 20px;
  background-color: #f9f9f9;
  border-top: 1px solid #eee;
  font-size: 12px;
  color: #666;
}
.info-left, .info-middle, .info-right {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.police-icon {
  width: 16px;
  height: 16px;
  margin-right: 4px;
  vertical-align: middle;
}
.icp-link, .license-link {
  color: #666;
  text-decoration: none;
}
.icp-link:hover, .license-link:hover {
  text-decoration: underline;
}
.dropdown-arrow {
  cursor: pointer;
  margin-left: 4px;
}
.report-zone-menu {
  list-style: none;
  padding: 0;
  margin: 0;
  margin-top: 4px;
}
.report-zone-menu li {
  margin: 2px 0;
}
.report-zone-menu li a {
  color: #666;
  text-decoration: none;
}
.report-zone-menu li a:hover {
  text-decoration: underline;
}
.lang-select select {
  padding: 4px;
  font-size: 12px;
}
</style>